import random

with open('words.txt','r',encoding = 'utf8') as f:
  f.seek(0)
  lines = f.readlines()
  lines = [l.replace('\n','') for l in lines] 

chinese = []
english = []
for i,l in enumerate(lines):
  if i % 2 == 0:
    chinese.append(l)
  else:
    english.append(l)

def get_list(list):
  wordsstr = ' '.join(list)
  wlist = wordsstr.split()
  return wlist

clist = get_list(chinese)
elist = get_list(english)

ilist = list(range(len(clist)))
random.shuffle(ilist)
clist = [clist[key] for key in ilist]
elist = [elist[key] for key in ilist]

Tanswer = 0
while True:
  answer = input(clist[Tanswer] + ': ')
  if answer == elist[Tanswer]:
    print('YES!'.rjust(8))
    Tanswer += 1

  elif answer == 'A':
    print('Right Answer: %s' %(elist[Tanswer]))

  else:
    print('NO!'.rjust(8))
  
  if Tanswer >= len(clist):
    print('____END____')
    break
